package com.xy;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;

import static com.opencv.OpencvApi.init;

/**
 * @author ：XiaoYu
 * @date ：2023/3/8 19:36
 * @version: :1.0
 * :
 */
public class T2 {
    public static void main(String[] args) throws AWTException, IOException {
        init(2, null);
        Robot robot = new Robot();

        robot.delay(2000);
        //获取指定矩形区域的屏幕图像
        BufferedImage bufferedImage = robot.createScreenCapture(new Rectangle(0, 300, 1920, 160));
        File f = new File("images\\BossAll.png");
        OutputStream os = new FileOutputStream(f);
        ImageIO.write(bufferedImage, "png", os);



    }
}
